package cn.rengy.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController(value = "newTestController")
@RefreshScope  // 替换配置bean
public class TestController {

	@Autowired  
	private StringRedisTemplate stringRedisTemplate;
	
    @Value("${common.name}")
    private String name;

    @RequestMapping("/common/get")
    public String hello() {
        return name;
    }

    
    @RequestMapping("/test/test1")
    public String test() {
    	stringRedisTemplate.opsForValue().set("a", "1");
        return "ok";
    }
}